using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;


namespace VisualEditorUILib
{
    sealed class GControlFactory
    {
        #region Variables

        private static volatile GControlFactory instance;
        private static object syncObj = new Object();

        #endregion

        #region Constructors

        //just private constructor
        private GControlFactory()
        {
        }

        #endregion

        #region Properties

        /// <summary>
        /// for getting instance of factory
        /// </summary>
        public static GControlFactory Instance
        {
            get
            {
                if ( null == instance )
                {
                    lock ( syncObj )
                    {
                        if (null == instance)
                        {
                            instance = new GControlFactory();
                        }
                    }
                }

                return instance;
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// produces new standard control.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Control GetControl ( string type)
        {
            if ("System.Windows.Forms.TextBox" == type)
            {
                TextBox tmp_textBox = new TextBox();
                tmp_textBox.Enabled = false;

                return tmp_textBox;
            }
            else if ("System.Windows.Forms.Label" == type)
            {
                Label tmp_label = new Label();
                tmp_label.Text = "Label";
                tmp_label.Enabled = false;
                tmp_label.BackColor = Color.Transparent;
                return tmp_label;
            }
            /*else if ("System.Windows.Forms.RadioButton" == type)
            {
                RadioButton tmp_radioButton = new RadioButton();
                tmp_radioButton.Enabled = false;
                return tmp_radioButton;
            }*/
            else if ("System.Windows.Forms.CheckBox" == type)
            {
                CheckBox tmp_chckbx = new CheckBox();
                tmp_chckbx.Enabled = false;
                return tmp_chckbx;
            }
            return null;
        }

        #endregion

    }
}
